#ifndef BASE_H
#define BASE_H

//#include <QTcpSocket>
#include <QTcpSocket>

class BaseTcp : public QTcpSocket
{
    Q_OBJECT
public:
    explicit BaseTcp(QObject *parent = nullptr);
    virtual ~BaseTcp();

signals:
    void emitData(QByteArray ba);
    void netStateSignals(int e);

public slots:
    ///连接网络
    ///
    void onSetting();
    void onConnect(QString ip, int port);
    void onSend( QString command);
    void onDisconnect();

    ///
    /// \brief on_connected
    ///tcp 状态
    void onConnected();
    void onDisconnectd();
    void onRead();
    void onError(QAbstractSocket::SocketError e);
    void onStateChange(QAbstractSocket::SocketState e);

private:
    void initConnect();
};


#endif // BASE_H
